package com.potenza.training.resume.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.potenza.training.resume.dao.WorkExperienceDao;
import com.potenza.training.resume.entity.WorkExperienceEntity;
import com.potenza.training.resume.service.WorkExperienceService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;


@Service("workExperienceService")
public class WorkExperienceServiceImpl extends ServiceImpl<WorkExperienceDao, WorkExperienceEntity> implements WorkExperienceService {

    @Resource
    private WorkExperienceDao workExperienceDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<WorkExperienceEntity> page = this.page(
                new Query<WorkExperienceEntity>().getPage(params),
                new QueryWrapper<WorkExperienceEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<WorkExperienceEntity> findByUid(Integer resumeId) {
        QueryWrapper<WorkExperienceEntity> resumeHopeQueryWrapper = new QueryWrapper<>();
        resumeHopeQueryWrapper.lambda().eq(WorkExperienceEntity::getResumeId,resumeId);
        return  workExperienceDao.selectList(resumeHopeQueryWrapper);
    }

}